*******************************
*Does Choice Bring Loyalty?   *
*Replication File, Elias Dinas*
*******************************



clear all
set more off*************************************************
*Figure1: See separate do.file, titled "Figure1"*
*************************************************use  ReplicationAJPS_MainDataset.dta**********Table 1*********************Column 1***********gologit2 strngpid73 strngpid65 eligible68, cluster(v7) autofitologit strngpid73 i.strngpid65 eligible68, cluster(v7)estsimp ologit strngpid73 strngpid65 eligible68 ,cluster(v7) genname(lk)setx meansimqi, fd(prval(2)) changex(eligible68 0 1)simqi, fd(prval(3)) changex(eligible68 0 1)drop lk1-lk5************Column 2 ************

**************************************************
*elig2false: 0: young eligibles; 1: old eligibles*
**************************************************gologit2 strngpid73 elig2f strngpid65 ,cluster(v7) autofit*****************************************************
*Including older eligibles, born before April 1947: * 
*****************************************************use Placebo_Test_Only_Eligibles.dta, clear

gologit2 strngpid73 elig2f strngpid65 ,cluster(v7) autofit
***********Column 3***********use  ReplicationAJPS_MainDataset.dtaivregress 2sls strngpid73 (voted68 = eligible68) , cluster(v7)***********Column 4***********ivregress 2sls strngpid73 col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 i.knowledge65 strngpid65  (voted68=eligible68),cluster(v7)************Column 5:*************See Rfile.**********Table 2**********reg v760 v251 eligible68 ,cluster(v7)reg v323 v141 eligible68 ,cluster(v7)reg v765 v146 eligible68 ,cluster(v7)reg v754 v246 eligible68 ,cluster(v7)reg v762 v245 eligible68 ,cluster(v7)reg v311 v63  eligible68 ,cluster(v7)reg v314 v69 eligible68 ,cluster(v7)gen ptyref65_1=0replace ptyref65_1=1 if m85_1!=.gen ptyref65_2=0replace ptyref65_2=1 if m85_2!=.gen ptyref65_3=0replace ptyref65_3=1 if m85_3!=.gen ptyref65_4=0replace ptyref65_4=1 if m85_4!=.gen ptyref73_1=0replace ptyref73_1=1 if v491!=.gen ptyref73_2=0replace ptyref73_2=1 if v492!=.gen ptyref73_3=0replace ptyref73_3=1 if v493!=.gen ptyref73_4=0replace ptyref73_4=1 if v494!=.gen ptyref65=ptyref65_1+ptyref65_2+ptyref65_3+ptyref65_4gen ptyref73=ptyref73_1+ptyref73_2+ptyref73_3+ptyref73_4reg ptyref73 ptyref65 eligible68 ,cluster(v7)gen consref65_1=0replace consref65_1=1 if m87_1!=.gen consref65_2=0replace consref65_2=1 if m87_2!=.gen consref65_3=0replace consref65_3=1 if m87_3!=.gen consref65_4=0replace consref65_4=1 if m87_4!=.gen consref73_1=0replace consref73_1=1 if v497!=.gen consref73_2=0replace consref73_2=1 if v498!=.gen consref73_3=0replace consref73_3=1 if v499!=.gen consref73_4=0replace consref73_4=1 if v500!=.gen consref65=consref65_1+consref65_2+consref65_3+consref65_4gen consref73=consref73_1+consref73_2+consref73_3+consref73_4reg consref73 consref65 eligible68 ,cluster(v7)**********Table 3*********************Column 1***********regress pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  , cluster(v7)bootstrap diff=(_b[eligible68]+_b[newrepelig68]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  bootstrap diff=(_b[eligible68]+_b[newdemelig68]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  ******************************With pid65 fully factorized******************************regress pid73 i.pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  , cluster(v7)lincom newdemelig68+eligible68lincom newrepelig68+eligible68***********column 2***********eivreg pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 , reliab(pid65 .90)bootstrap diff=(_b[eligible68]+_b[newdemelig68]),/**/ rep(100) strata(v7): eivreg pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  , reliab(pid65 .90)bootstrap diff=(_b[eligible68]+_b[newrepelig68]),/**/ rep(100) strata(v7): eivreg pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  , reliab(pid65 .90)***********Column 3*	**********ologit pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 ,cluster(v7)lincom newdemelig68+eligible68lincom newrepelig68+eligible68bootstrap diff=(_b[eligible68]+_b[newrepelig68]),/**/ rep(100) strata(v7): ologit pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  bootstrap diff=(_b[eligible68]+_b[newdemelig68]),/**/ rep(100) strata(v7): ologit pid73 pid65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68  ***********Table 4***************************column 1 row 1*****************bootstrap diff=(_b[eligible68]+_b[eldem68]+_b[newdemelig]+_b[newhum68dem65]),/**/ rep(100) strata(v7): regress pid73 dem65 rep65  eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  *****************column 2 row 1*****************bootstrap diff=(_b[eligible68]+_b[elrep68]+_b[newrepelig]+_b[newnx68rep65]),/**/ rep(100) strata(v7): regress pid73 dem65 rep65  eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  *****************column 1 row 2*****************bootstrap diff=(_b[eligible68]+_b[elrep68]+_b[newdemelig]+_b[newhum68rep65]),/**/ rep(100) strata(v7): regress pid73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  *****************column 2 row 2*****************bootstrap diff=(_b[eligible68]+_b[eldem68]+_b[newrepelig]+_b[newnx68dem65]),/**/ rep(100) strata(v7): regress pid73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  *****************column 1 row 3*****************bootstrap diff=(_b[eligible68]+_b[newdemelig]),/**/ rep(100) strata(v7): reg rep73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65   *****************column 2 row 3*****************bootstrap diff=(_b[eligible68]+_b[newrepelig]),/**/ rep(100) strata(v7): reg rep73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  *****************column 1 row 4*****************bootstrap diff=(_b[eligible68]+_b[newdemelig]+_b[elrep68]+_b[newhum68rep65]),/**/ rep(100) strata(v7): reg dem73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  ****************column2 row 4****************bootstrap diff=(_b[eligible68]+_b[newrepelig]+_b[eldem68]+_b[newnx68dem65]),/**/ rep(100) strata(v7): reg rep73 dem65 rep65 eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  ***********Figure 2***********regress strngpid73 strngpid65 consistent incons eligible68 consel inconsel , cluster(v7)bootstrap diff=(_b[consel]+_b[eligible68]),/**/ rep(100) strata(v7): regress strngpid73 strngpid65 consistent incons eligible68 consel inconsel bootstrap diff=(_b[inconsel]+_b[eligible68]),/**/ rep(100) strata(v7): regress strngpid73 strngpid65 consistent incons eligible68 consel inconsel bootstrap diff=((_b[consel]-_b[inconsel])-(_b[consistent]-_b[incons])),/**/ rep(100) strata(v7): regress strngpid73 strngpid65 consistent incons eligible68 consel inconsel ***********Figure 3***********regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 , cluster(v7) bootstrap diff=(_b[eligible68]+_b[newdemelig68]+_b[elhummc72]+_b[newdemelig68mc72]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 bootstrap diff=(_b[eligible68]+_b[newrepelig68]+_b[elhumix72]+_b[newrepelig68nix72]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 bootstrap diff=(_b[eligible68]+_b[newdemelig68]+_b[elhumix72]+_b[newdemelig68nix72]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 bootstrap diff=(_b[eligible68]+_b[newrepelig68]+_b[elhummc72]+_b[newrepelig68mc72]),/**/ rep(100) strata(v7): regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 ***********Appendix***********************Table A.1************gen votedff=0replace votedff=1 if v114!=5 & v114!=.gen votedmm=0replace votedmm=1 if v118!=5 & v118!=.ttest pid65 ,by(eligible68)ttest strngpid65 ,by(eligible68)  ttest knowledge65 if knowledge65<99,by(eligible68)ttest black ,by(eligible68)  ttest gn1 ,by(eligible68)ttest col1 ,by(eligible68)ttest col2 ,by(eligible68)ttest col3 ,by(eligible68)ttest col4 ,by(eligible68)ttest votedff ,by(eligible68)ttest votedmm ,by(eligible68)ttest plf1 ,by(eligible68)ttest plf2 ,by(eligible68)ttest plf3 ,by(eligible68)ttest plm1 ,by(eligible68)ttest plm2 ,by(eligible68)ttest plm3 ,by(eligible68)ttest pidm if pidm<99,by(eligible68)ttest pidf if pidf<99,by(eligible68)ttest polintf  if polintf<99,by(eligible68)ttest polintm  if polintm<99,by(eligible68)ksmirnov pid65 ,by(eligible68)ksmirnov strngpid65 ,by(eligible68)
ksmirnov knowledge65,by(eligible68)ksmirnov pidf  if pidf<99,by(eligible68)ksmirnov pidm  if pidm<99,by(eligible68)ksmirnov polintf  if polintf<99,by(eligible68)ksmirnov polintm  if polintm<99,by(eligible68)ksmirnov v251,by(eligible68)*************************
*Omnibus Test: See Rfile*
*************************************Table A.2************regress pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 i.v251 if v503!=., cluster(v7)bootstrap diff=(_b[eligible68]+_b[demelig]),/**/ rep(100) strata(v7): regress pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 i.v251 if v503!=.bootstrap diff=(_b[eligible68]+_b[repelig]),/**/ rep(100) strata(v7): regress pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 if v503!=.ologit pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 i.v251 if v503!=., cluster(v7)bootstrap diff=(_b[eligible68]+_b[demelig]),/**/ rep(100) strata(v7): ologit pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 i.v251 if v503!=.bootstrap diff=(_b[eligible68]+_b[repelig]),/**/ rep(100) strata(v7): ologit pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 i.v251 if v503!=.tab v251,gen(kn)estsimp ologit pid73 eligible68 mcgovern nixon72 demelig repelig col1 col2 col3 col4 gn1 black vtf1 vtm1 plf1 plf2 plf3/**/ plm1 plm2 plm3 pm1 pm2 pm3 pm4 pm5 pm6 pf1 pf2 pf3 pf4 pf5 pf6 pid65 kn1-kn6 if v503!=., cluster(v7) genname(lk)
setx mean
setx mcgovern 1 nixon72 0 repelig 0
simqi, fd(prval(0)) changex(eligible68 0 1 demelig 0 1)simqi, fd(prval(1)) changex(eligible68 0 1 demelig 0 1)setx mcgovern 0 nixon72 1 demelig 0
simqi, fd(prval(6)) changex(eligible68 0 1 repelig 0 1)simqi, fd(prval(5)) changex(eligible68 0 1 repelig 0 1)drop lk1-lk44************Table A.3************regress pid73 dem65 rep65  eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  , cluster(v7)regress dem73 dem65 rep65  eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  , cluster(v7)regress rep73 dem65 rep65  eligible68 newhumphrey68 newnixon68/**/ newdemelig68 newrepelig68 eldem68 elrep68 hum68dem65 hum68rep65 nx68dem65 nx68rep65 newhum68dem65/**/ newhum68rep65 newnx68dem65 newnx68rep65  , cluster(v7)************Table A.4************regress strngpid73 strngpid65 consistent incons eligible68 consel inconsel , cluster(v7)************Table A.5************regress pid73 pid65 eligible68 newhumphrey68 newnixon68 nixon72 mcgovern/**/ newdemelig68 newrepelig68 elhumix72 newnixix72 newhumix72 newrepelig68nix72/**/ newdemelig68nix72 elhummc newnixmc72 newhummc72 newrepelig68mc72 newdemelig68mc72 , cluster(v7)*********************************************Table A.6-A.9: See ANES_ReplicationFile.do**********************************************************Table A.10*************use Four_Waves_Dataset.dta, clear
*ssc install gllammgllamm strngpid wave wavesq  waveal wavesqal if age>9 & age<22, i(id v7) link(ologit) fam(bin) adapt robust********************Code for Figure 5********************forvalues x=1/100 {use Four_Waves_Dataset.dtakeep if pid73!=.bsample, strata(v7)gllamm strngpid wave wavesq  waveal wavesqal , i(id v7) link(ologit) fam(bin) adapt robustgen u1 = 0gen u2 = 0gllapred p_cond, mu us(u) above(1)egen pr1=mean(p_cond if wave==1 & wavesq==1 & waveal==0 & wavesqal==0)egen pr2=mean(p_cond if wave==1 & wavesq==1 & waveal==1 & wavesqal==1)egen pr3=mean(p_cond if wave==2 & wavesq==4 & waveal==0 & wavesqal==0)egen pr4=mean(p_cond if wave==2 & wavesq==4 & waveal==2 & wavesqal==4)egen pr5=mean(p_cond if wave==3 & wavesq==9 & waveal==0 & wavesqal==0)egen pr6=mean(p_cond if wave==3 & wavesq==9 & waveal==3 & wavesqal==9)keep pr1 pr2 pr3 pr4 pr5 pr6 save Four_Waves_Dataset`x'.dta, replace}forvalues x=1/100 {use Four_Waves_Dataset`x'.dtaegen meanpr1=mean(pr1)egen meanpr2=mean(pr2)egen meanpr3=mean(pr3)egen meanpr4=mean(pr4)egen meanpr5=mean(pr5)egen meanpr6=mean(pr6)gen meandd73=meanpr2-meanpr1gen meandd82=meanpr4-meanpr3gen meandd97=meanpr6-meanpr5keep meandd73 meandd82 meandd97gen id=_nkeep if id==1use Four_Waves_Dataset`x'DD.dta}use Four_Waves_Dataset1DD.dtaforvalues x=2/100 {append using Four_Waves_Dataset`x'DD.dta}sum meandd73, dsum meandd82, dsum meandd97, d***********************************************************************************97th and 2.5th percentiles are used for the construction of the confidence bands*************************************************************************************************************************************************************************************************************************************************************Missing Data analysis: Footnote 5************************************clear alluse Missing_Data_65_73.dta, clear gen missing=0replace missing=1 if v5!=. & v5_2==.gen pid65_2=V149-11replace pid65_2=. if V149>17gen strng65=0 if pid65_2==3replace strng65=1 if pid65_2==2 | pid65_2==4replace strng65=2 if pid65_2==1 | pid65_2==5replace strng65=3 if pid65_2==0 | pid65_2==6reg missing eligible68 ,cluster(V6)reg strng65 missing ,cluster(V6)**********************************************************************************************************************************************************************Test for Parents: Footnote 10********************************use Parents_Dataset.dta, clear gen strngpid65=0 if v66==4replace strngpid65=1 if v66==3 | v66==5replace strngpid65=2 if v66==2 | v66==6replace strngpid65=3 if v66==1 | v66==7tab strngpid65,gen(ss)gen strngpid73=0 if v510==3replace strngpid73=1 if v510==2 | v510==4replace strngpid73=2 if v510==1 | v510==5replace strngpid73=3 if v510==0 | v510==6gen stng=0replace stng=1 if strngpid73==2replace stng=1 if strngpid73==3replace stng=. if strngpid73==.gen vtd68=0replace vtd68=1 if v540==1estsimp logit stng ss2-ss4 vtd68, cluster(v293) genname(ll)setx meansimqi, fd(pr) changex(vtd68 0 1)***************************************************************************************************************************************


**********************************************************************
*Analysis reported in Footnote 2 of the online supplementary material*
**********************************************************************

use  ReplicationAJPS_MainDataset.dta, clear

bysort v7:egen perceligibles=mean(eligible68)polychoric v141 perceligiblespwcorr v141 perceligibles, sigpolychoric v251 perceligiblespwcorr v251 perceligibles, sig****************************************************************************
*first stage (analysis mentioned on page 3 of online supplementary material*
****************************************************************************

polychoric eligible68 voted68


**************************************************************
*Analysis reported on page 5 of online supplementary material*
**************************************************************


corr newnixon68 nixon72 if eligible68==1
corr newnixon68 nixon72 if eligible68==0

corr newhumphrey68 mcgovern if eligible68==1
corr newhumphrey68 mcgovern if eligible68==0


